# Maintainer: Conrad Hoffmann <ch@bitfehler.net>
pkgname=docker-auth
pkgver=1.11.0
pkgrel=5
pkgdesc="Authentication server for Docker Registry 2"
url="https://github.com/cesanta/docker_auth"
arch="all"
license="Apache-2.0"
makedepends="go"
install="$pkgname.pre-install"
pkgusers="docker-auth"
pkggroups="docker-auth"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/cesanta/docker_auth/archive/refs/tags/$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	reference-example.patch
	"
builddir="$srcdir/docker_auth-$pkgver"
options="net"

build() {
	make -C auth_server VERSION="$pkgver" BUILD_ID="$pkgver@alpine" build
}

check() {
	./auth_server/auth_server -h
}

package() {
	install -D -m755 auth_server/auth_server "$pkgdir"/usr/bin/$pkgname
	install -D -m640 -o $pkgusers -g $pkggroups \
		examples/reference.yml "$pkgdir"/etc/$pkgname/config.yml
	install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -D -m644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
3fcf54566ed22c9c9b5507695f5f50deb83312218820ab9a189e8ad5070f9514abb2a3888a5848f6c15fba2a3ef9b310021f24d9263600a3b54deaad30bd7ad5  docker-auth-1.11.0.tar.gz
019969b04fca65c72f8a699814b6746885f815bebd985c706883170b15ba159b353aaa1c62524f4b43c960c183039f6f123260a820752817bfded4585330b8d1  docker-auth.initd
fece8767508923b72d86ae106099d97cf92ab43f776fbc4ccc98fb751dff6650101df17827b51c25748052e4fc3f5e21139b84712cef0bfb6366ba8c8afcd1b9  docker-auth.confd
c0132fe460bcfe36a0c7b16d543509516b5a0239e710cf9995809259d0112dbe408a1a6080b3b044127c2d0b48dd9a726db3f707d4073800067302282b44e016  reference-example.patch
"
